<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input name='username' type="text" placeholder="用户名">
    <input name="nickname" type="text" placeholder="昵称">
    <input name="race" type="text" placeholder="人1，妖2,鬼3，神4，仙5，魔6">
    <button type="button">Login</button>
    <script src="./axios.min.js"></script>
    <script>
        var button = document.getElementsByTagName('button')[0];
        var username = document.getElementsByName('username')[0];
        var nickname = document.getElementsByName('nickname')[0];
        var race = document.getElementsByName('race')[0];
      
        button.onclick = function () {
            //console.log(username.value,nickname,race)
            axios.post('http://localhost:3000/users/login', {
                username:username.value,
                nickname:nickname.value,
                race:race.value
            }).then(res=>{
                console.log(res,'res')
                if(res.data.code == 200){
                    //alert(res.data.msg);
                    console.log(res.data.msg);
                }else{
                    //alert(res.data.msg);
                    console.log(res.data.msg);
                }
            })
        }
    </script>
</body>
</html>